String Quotes | Example |
---|---|
Single quotes | 'Welcome to CCIT' |
Double quotes | "Welcome to CCIT" |
Triple quotes | '''Welcome to CCIT Amravati''' """Welcome to CCIT Amravati""" |
a="Welcome to CCIT" print(a.capitalize()) >>> Welcome to ccit |
a="Welcome to CCIT" print(a.lower()) >>> welcome to ccit |
a="Welcome to CCIT" print(a.upper()) >>> WELCOME TO CCIT |
a="Welcome to CCIT" print(a.swapcase()) >>> wELCOME TO ccit |
a="Welcome to CCIT" print(a.title()) >>> Welcome To Ccit |
a="Welcome to CCIT" print(a.isalnum()) >>> True |
a="Welcome to CCIT" print(a.isalpha()) >>> True |
a="1234" print(a.isdigit()) >>> True |
a="CCIT" print(a.isupper()) >>> True |
a="ccit" print(a.islower()) >>> True |
a=" " print(a.isspace()) >>> True |
a="Welcome to CCIT" print(a.isalnum()) >>> True |
a="Welcome to CCIT" print(a.isalpha()) >>> True |
a="1234" print(a.isdigit()) >>> True |
a="CCIT" print(a.isupper()) >>> True |
a="ccit" print(a.islower()) >>> True |
a=" " print(a.isspace()) >>> True |
a="Welcome to CCIT" print(a.isalnum()) >>> True |
a="Welcome to CCIT" print(a.isalpha()) >>> True |
a="1234" print(a.isdigit()) >>> True |
a="CCIT" print(a.isupper()) >>> True |
a="ccit" print(a.islower()) >>> True |
a=" " print(a.isspace()) >>> True |
a="Welcome to CCIT" print(a.isalnum()) >>> True |
a="Welcome to CCIT" print(a.isalpha()) >>> True |
a="1234" print(a.isdigit()) >>> True |
a="CCIT" print(a.isupper()) >>> True |
a="ccit" print(a.islower()) >>> True |
a=" " print(a.isspace()) >>> True |
import java.util.Scanner; class demo { public static void main(String args[]) { String s ="Amravati is smart city"; int c = 0 ; for( int i=0;i<s.length();i++) { char ch = s.charAt( i ); if(ch=='a' || ch=='A') c=c+1; } System.out.println("Count is "+c); } }
Count is 4
import java.util.Scanner; class demo { public static void main(String args[]) { String s ="Amravati is smart city"; int c=0; for(int i=0;i<s.length();i++) { char ch =s.charAt(i); if( ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'|| ch=='u'||ch=='U' ) c=c+1; } System.out.println("Total Vowels are "+c); } }
Total Vowels are 7
import java.util.Scanner; class demo { public static void main(String args[]) { String s = "Amravati is smart city"; int c=0; for(int i=0;i<s.length();i++) { char ch = s.charAt( i ); if( ch == ' ') c=c+1; } System.out.println("Total Words are "+(c+1)); } }
Total words are 4
import java.util.Scanner; class demo { public static void main(String args[]) { String s = "amravati"; String r = ""; for(int i=0;i<s.length();i++) { char ch=s.charAt(i); r = ch+r; } System.out.println("Reverse is "+r); } }
Reverse is itavarma